﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
	<meta charset="utf-8" />

    <script src='../Script/easyui/jquery.min.js'></script>
    <script src='../Script/easyui/jquery.easyui.min.js'></script>
    <script src='../Script/easyui/locale/easyui-lang-zh_CN.js'></script>
    <link href="../Script/easyui/themes/default/easyui.css" rel="stylesheet" id="easyuiTheme" />
    <link href="Script/easyui/themes/icon.css" rel="stylesheet" />
    <script src='../Script/changeEasyUITheme.js'></script>
    <link href="CSS/list.css" rel="stylesheet" />
    <script src='../ckeditor/ckeditor.js'></script>

    <script type="text/javascript">
        var strXmlConfig = "";//摄像头配置文件
        var StartTime;
        var EndTime;
        var devid;

        var mq_indexCode = "";
        var mq_ip = "";
        var mq_port = "";
        var mq_username = "";
        var mq_password = "";

        $(function () {
            $.ajax({
                type: "post",
                dataType: "json",
                url: "GetWeather.ashx?action=queryMQ_QJ",
                success: function aa(data) {
                    strXmlConfig = data.rows[0].mmark;

                    mq_indexCode = data.rows[0].mq_indexCode;
                    mq_ip = data.rows[0].mq_ip;
                    mq_port = data.rows[0].mq_port;
                    mq_username = data.rows[0].mq_username;
                    mq_password = data.rows[0].mq_password;

                    
                    OnInit();//初始化控件
                    LoginPlatPlayBack();//登錄平臺
                }
            });


        });
    </script>

    <SCRIPT>
        function LoginPlatPlayBack() {
            //Demo默认使用密码登录方式
            //var IP = document.frmApp.IP.value;
            //var port = document.frmApp.port.value;
            //var UserName = document.frmApp.UserName.value;
            //var Password = document.frmApp.Password.value;

            var IP = mq_ip;
            var port = mq_port;
            var UserName = mq_username;
            var Password = mq_password;

            var v1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><LoginInfo><LoginType>2</LoginType><IP>" + IP + "</IP><Port>" + port
			+ "</Port><UserName>" + UserName + "</UserName><Password>" + Password + "</Password></LoginInfo>";
            //alert(v1);
            var v = playback.LoginPlat(v1);
            if (v != 0)
                alert("登录失败，请查看日志playback.log");

            var hm = $('#mymap').height();
            $("#mymq").height(hm);
            var my1 = $('#my1').height();
            var yj = $('#yjfx').height();
            var myh = parseInt(my1) + parseInt(yj) + 30;
            $('#mym').height(myh);
        }
        function OnInit() {
			document.getElementById('ocxContainer').innerHTML = '<object classid="clsid:88F0ADA4-0B55-49EE-BD4E-FC87AD058DEF" id="playback"  width="800" height="600" name="ocx" ></object>';
			var _param = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
				+ "<PlaybackOcxConfig><DecodeEffect>0</DecodeEffect><PlayMode>0</PlayMode><SupportFishEye>1</SupportFishEye>"
				+ "<WindowToolbar><ShowMode>2</ShowMode><ShowItems><BtnItem>0</BtnItem><BtnItem>5</BtnItem><BtnItem>7</BtnItem>"
				+ "<BtnItem>12</BtnItem><BtnItem>17</BtnItem><BtnItem>21</BtnItem><BtnItem>32</BtnItem></ShowItems></WindowToolbar>"
				+ "<SnapParam><FileFormat>0</FileFormat><FilePath>C:\\Users\\huangjunyf2\\Documents\\capture\\</FilePath>"
				+ "<FileCategorization>0</FileCategorization><FileNameFormat></FileNameFormat><SnapMode>2</SnapMode>"
				+ "<ContinousNum>3</ContinousNum><ContinousMode>2</ContinousMode><ContinousInterval>1000</ContinousInterval></SnapParam>"
				+ "<ClipParam><FilePath>C:\\Users\\huangjunyf2\\Documents\\clip\\</FilePath><FileNameFormat></FileNameFormat><PackSize>256</PackSize></ClipParam>"
				+ "<DiskWarning><EnableDiskWarning>0</EnableDiskWarning><WarningSpace>500</WarningSpace><MinimumSpace>100</MinimumSpace></DiskWarning></PlaybackOcxConfig>";
			//alert(_param);
			playback.SetLocalParam(_param);
		}

		function OnPlayback(){
			var _param = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
				+ "<PlaybackBasicInfo><CameraName>Camera 051gvv</CameraName>"
				+ "<ServerType>1</ServerType><ServerIP>10.20.147.116</ServerIP><ServerPort>6300</ServerPort>"
				+ "<BeginTime>2016-01-08T00:00:00.000Z</BeginTime><EndTime>2016-01-08T23:59:59.000Z</EndTime>"
				+ "<SupportKFImg>1</SupportKFImg><CuInfo><UserName>admin</UserName><CuZoneId>1</CuZoneId>"
				+ "<CmsIp>10.20.147.116</CmsIp><CmsPort>80</CmsPort><CmsContext></CmsContext>"
				+ "<VmsIp>10.20.147.116</VmsIp><VmsPort>80</VmsPort><VmsContext></VmsContext></CuInfo>"
				+ "<RightCode>10034,10033,10032,10020,10027,10014,10001,10028,10002,10015,10005,10010,10024,10006,10011,10003,10021,10012,10022,10004,10013,10009,10029</RightCode>"
				+ "<CameraIndexCode>16395864001310000012</CameraIndexCode><DeviceInfo><DeviceName>Embedded Net DVR</DeviceName><DeviceIndexcode>16395864001310000012</DeviceIndexcode>"
				+ "<DeviceManufacturer>0</DeviceManufacturer><ProductSeries>1</ProductSeries></DeviceInfo><CascadeInfo><CascadeServerIp>10.20.147.116</CascadeServerIp>"
				+ "<CascadeServerPort>null</CascadeServerPort></CascadeInfo><PlaybackPerformance><DecodeEffect>5</DecodeEffect></PlaybackPerformance></PlaybackBasicInfo>";
			//alert(_param);
			var _index = playback.GetIdleWndIndex();
			playback.SetBasicInfo(_index, _param);
		}

		function OnPlaybackEx() {

		    var Code = mq_indexCode;

		    var beginTime = getNowFormatDate() + "T00:00:00.000Z";
		    var endTime = getNowFormatDate() + "T23:59:59.000Z";

			var _param = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
				+ "<PlaybackBasicInfo><CameraIndexCode>" + Code + "</CameraIndexCode>"
				+ "<StoreDeviceType>0</StoreDeviceType>"
				+ "<BeginTime>" + beginTime + "</BeginTime><EndTime>" + endTime + "</EndTime>"
				+ "</PlaybackBasicInfo>";

		    playback.SetBasicInfoEx(_param);

			//alert(_param);
		}

		function getNowFormatDate() {
		    var date = new Date();
		    var seperator1 = "-";
		    var seperator2 = ":";
		    var month = date.getMonth() + 1;
		    var strDate = date.getDate();
		    if (month >= 1 && month <= 9) {
		        month = "0" + month;
		    }
		    if (strDate >= 0 && strDate <= 9) {
		        strDate = "0" + strDate;
		    }
		    //var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
            //        + " " + date.getHours() + seperator2 + date.getMinutes()
		    //        + seperator2 + date.getSeconds();

		    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
		    return currentdate;
		}
    </script>
</head>
<body>
    <div id="mymq" style="overflow-y: scroll;">
        <div style="overflow:auto;">
            <table>
                <tr>
                    <td>
                        <div>
                            &nbsp;&nbsp;&nbsp;<br />
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <!-- 添加回放控件（需要先在windows下注册） -->
                            <div id="ocxContainer" style="width:100%;height:100%">
                            </div>
                        </div>

                    </td>
                    <td>

                        <div style="margin-left:20px;">
                            <table>
                                <tr>
                                    <td align="center">
                                        <input type="button" name="mq_preview" onclick="OnPlaybackEx()"
                                               style="background-image:url('../images/mq_preview.jpg'); width:62px;height:78px; border:0"
                                               onmouseover="this.style.cursor='hand'">&nbsp;
                                    </td>
                                </tr>
                            </table>



                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        注：如不能正常显示图像，请下载并安装摄像头组件：<a href="../download/ocx.exe">摄像头组件</a>，
                        请使用IE8浏览器
                    </td>
                </tr>
            </table>

        </div>
        <div id="mym" class="easyui-panel" style="overflow:auto;">
            <div class="easyui-panel" id="my1" data-options="title: '苗情历史信息'" style="background: #eee; height: 450px;">
                <table id="mtgrid"></table>
                <div id="tab_toolbars" style="padding: 4px;">
                    <table cellpadding="0" cellspacing="0" style="width: 100%">
                        <tr>
                            <td style="padding-left: 2px">

                                <div style="padding: 2px;">
                                    时间从:
                                    <input id="StartTime" class="easyui-datebox" style="width: 100px" />
                                    到:
                                    <input id="EndTime" class="easyui-datebox" style="width: 100px" />
                                    <select id="jd" class="easyui-combobox" name="jd" style="width: 80px;">
                                        <option value="季度">季度</option>
                                        <option value="一季度">一季度</option>
                                        <option value="二季度">二季度</option>
                                        <option value="三季度">三季度</option>
                                        <option value="四季度">四季度</option>
                                        <option value="当天">当天</option>
                                    </select>

                                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="reloadgrid()">查找</a>
                                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="Export('excel', $('#mtgrid'));">导出</a>
                                    <a href="#" onclick="newUser();" id="a_add" class="easyui-linkbutton" iconcls="icon-add">添加</a>
                                    <a href="#" onclick="remove();return false;" id="a_del" class="easyui-linkbutton" iconcls="icon-cancel">删除</a>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <div id="yjfx" class="easyui-panel yjfx">

            </div>
        </div>
    </div>

    <!--<SCRIPT LANGUAGE="JavaScript" FOR="window" EVENT="onLoad()">
        OnInit();//初始化控件
        LoginPlatPlayBack();//登錄平臺
    </SCRIPT>-->

</body>
</html>
